{% load i18n %}{% spaceless %}
<h1>{% trans "Transaction" %}: {{ object.text }}</h1>
<ol class="breadcrumb">
    <li>{% trans "Project" %}</li>
    {% if object.project_id %}
    <li><a href="{{ object.project.bmfmodule_detail }}">{{ object.project }}</a></li>
    {% else %}
    <li>{% trans "None" %}</li>
    {% endif %}
</ol>
<table class="table table-striped table-condensed table-hover">
    <thead>
        <tr>
            <th>
                <span class="glyphicon glyphicon-collapse-down"></span>
                {% trans "Date" %}
            </th>
            <th>{% trans "Account" %}</th>
            <th class="text-right">{% trans "Debit" %}</th>
            <th class="text-right">{% trans "Credit" %}</th>
            <th></th>
        </tr>
    </thead>
    {% if object.draft %}
    <tfoot>
      <tr>
        <td colspan="2"></td>
        <td class="text-right">{{ object.balance_debit }}</td>
        <td class="text-right">{{ object.balance_credit }}</td>
        <td class="text-right">
          <a class="btn btn-xs bmf-edit btn-bmfcreate" href="{% url "djangobmf:moduleapi_djangobmf_accounting_transactionitem:create" "default" %}?set-transaction={{ object.pk }}">
            <span class="glyphicon glyphicon-plus"></span>
          </a>
        </td>
      </tr>
    </tfoot>
    {% endif %}
    <tbody>
      {% for obj in object.items.all %}
      <tr>
        <td>
            {% if obj.draft %}
            <span class="glyphicon glyphicon-unchecked"></span>
            {% else %}
            <span class="glyphicon glyphicon-check"></span>
            {% endif %}
            {{ obj.date|date:"SHORT_DATE_FORMAT" }}
        </td>
        <td><a href="{{ obj.account.bmfmodule_detail }}">{{ obj.account }}</a></td>
        <td class="text-right">{% if not obj.credit %}{{ obj.amount }}{% endif %}</td>
        <td class="text-right">{% if obj.credit %}{{ obj.amount }}{% endif %}</td>
        {% if obj.draft %}
        <td class="text-right">
            <a class="btn btn-xs bmfedit btn-bmfupdate" href="{# get_bmf_url obj "update" #}">
            <span class="glyphicon glyphicon-wrench"></span>
          </a>
        </td>
        {% else %}
        <td class="text-right">
            <a class="btn btn-xs btn-default disabled" href="#">
            <span class="glyphicon glyphicon-wrench"></span>
          </a>
        </td>
        {% endif %}
      </tr>
      {% endfor %}
    </tbody>
</table>
{% endspaceless %}
